#ifndef __CONFIG_H
#define __CONFIG_H

#include <Arduino.h>
#include "config.private.h"

// #define URL_WEATHER "https://e.weather.com.cn/mweather/101210101.shtml"
#define WEATHER_URL_TODAY "https://api.seniverse.com/v3/weather/now.json"
#define WEATHER_URL_FORECAST "https://api.seniverse.com/v3/weather/daily.json"
#define WEATHER_URL_LANGUAGE_EN "en"
#define WEATHER_URL_LANGUAGE_CN "zh-Hans"

#define URL_POETRY "https://v1.jinrishici.com"

// NTP配置参数, 使用阿里云的NTP服务器
static const char *ntpServerUrl1 = "ntp1.aliyun.com";
static const char *ntpServerUrl2 = "ntp2.aliyun.com";
static const char *ntpServerUrl3 = "ntp3.aliyun.com";

// WIFI
#define WIFI_RETRY_COUNT 20
#define WIFI_STA_SSID "PMatrix_WiFi_config"
#define WIFI_STA_PWD "12365478"

// matrix
#define MATRIX_WIDTH 32
#define MATRIX_HEIGHT 8
#define MATRIX_NUM_LEDS (MATRIX_WIDTH * MATRIX_HEIGHT)
#define MATRIX_DATA_PIN 48
#define MATRIX_BRIGHTNESS 80
// 主题色
#define THEME_COLOR_TEXT 0xE8EAC3    // rgb(232,234,195)
#define THEME_COLOR_DANGER 0xEC6B81  // rgb(236,107,129)
#define THEME_COLOR_SUCCESS 0x4A7446 // rgb(74,116,70)
#define THEME_COLOR_WARNING 0xEBF706 // rgb(235,247,6)

// tick
#define TICK_SYS 1 // ms
#define TICK_SYS_BASE_MULTIPLIER 50
#define INTERVAL_UPDATE_TIME    (TICK_SYS * TICK_SYS_BASE_MULTIPLIER * 18)
#define INTERVAL_UPDATE_DATE    (TICK_SYS * TICK_SYS_BASE_MULTIPLIER * 20 * 60 * 5) // 5min
#define INTERVAL_UPDATE_WEATHER (TICK_SYS * TICK_SYS_BASE_MULTIPLIER * 20 * 60 * 10) // 10min

// animation
// 动画间隔 x 倍于TICK_SYS
#define INTERVAL_ANIM_MULTIPLIER_DEFAULT          (2 * TICK_SYS_BASE_MULTIPLIER)
#define INTERVAL_ANIM_MULTIPLIER_RAINING          INTERVAL_ANIM_MULTIPLIER_DEFAULT
#define INTERVAL_ANIM_MULTIPLIER_DATE             INTERVAL_ANIM_MULTIPLIER_DEFAULT
#define INTERVAL_ANIM_MULTIPLIER_AUDIO_SPECTRUM   INTERVAL_ANIM_MULTIPLIER_DEFAULT
#define INTERVAL_ANIM_MULTIPLIER_TIMER            INTERVAL_ANIM_MULTIPLIER_DEFAULT
#define INTERVAL_ANIM_MULTIPLIER_WEATHER          INTERVAL_ANIM_MULTIPLIER_DEFAULT
#define INTERVAL_ANIM_MULTIPLIER_AHT20            INTERVAL_ANIM_MULTIPLIER_DEFAULT

#define INTERVAL_ANIM_CNT_INIT_VALUE            (-1)

// display
// (0,0)--->---- | |-----------------> X -----------------------
// |             | |                    content                 |
// Y             | |                                            |
// |    icon     | |                                            |
// --------------| |--------------------------------------------|
// #define SWITCH_MODE_ANIM_ENABLE // 是否开启模式切换动画

#ifdef SWITCH_MODE_ANIM_ENABLE
#define DISPLAY_ICON_Y_START_DEFAULT 0 // 不动画
#else
#define DISPLAY_ICON_Y_START_DEFAULT -8 // 从上到下动画
#endif
#define DISPLAY_ICON_Y_END_DEFAULT 0
#define DISPLAY_ICON_WIDTH_DEFAULT 8
#ifdef SWITCH_MODE_ANIM_ENABLE
#define DISPLAY_CONTENT_X_START_DEFAULT 12 
#else 
#define DISPLAY_CONTENT_X_START_DEFAULT 20 
#endif
#define DISPLAY_CONTENT_X_END_DEFAULT (DISPLAY_ICON_WIDTH_DEFAULT + 1)

#endif
